package com.xzm.springboot.controller;

import com.xzm.springboot.entity.User;
import com.xzm.springboot.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 3052
 * @create 2020-08-10 22:17
 */
@RestController
public class UserController {

    @Autowired
    UserRepository userRepository;

    @RequestMapping("/user/{id}")
    public User selcetUserById(@PathVariable("id") Integer id){
       User user = userRepository.findOne(id);
       return user;
    }
}
